#ifndef CHANGE_H
#define CHANGE_H

#include "dllspec.h"
#include "gameobject.h"
#include <SFML/Network.hpp>


struct DLL_EXPORT Change
{
	sf::Uint32 timestamp;
	sf::Uint32 number;
	sf::Uint8 type;
	union
	{
		GameObject* newObject; // When creating objects
		sf::Uint32 destoyedObjectID; // When destroying an object (a player dissed)
		struct
		{
			sf::Uint8 controls; // Player input
			sf::Uint32 shipID;
		} shipControl;
	};

	Change();
	Change(sf::Uint32 timestamp, sf::Uint32 number);
	Change(sf::Uint32 timestamp, sf::Uint32 number, const GameObject& object);
	Change(sf::Uint32 timestamp, sf::Uint32 number, sf::Uint32 objectID);
	Change(sf::Uint32 timestamp, sf::Uint32 number, sf::Uint32 shipID, sf::Uint8 controls);
	~Change();
};

DLL_EXPORT sf::Packet& operator <<(sf::Packet& packet, const Change& obj);
DLL_EXPORT sf::Packet& operator >>(sf::Packet& packet, Change& obj);

#endif // CHANGE_H
